#!/usr/bin/env python
# vim:fileencoding=utf-8

from calibre.web.feeds.news import BasicNewsRecipe


class Project(BasicNewsRecipe):
    title = 'The Project'
    __author__ = 'bugmen00t'
    description = 'The Project is an independent Russian media specialising in in-depth journalism.'
    publisher = 'Roman Badanin'
    category = 'blog'
    cover_url = u'https://proektmedia-stat.ams3.digitaloceanspaces.com/2018/08/proektmedia_facebook_default.png'
    language = 'en_RU'
    no_stylesheets = False
    remove_javascript = False
    auto_cleanup = False
    oldest_article = 600
    max_articles_per_feed = 20

    remove_tags_before = dict(name='main')

    remove_tags_after = dict(
        name='div', attrs={'class': 'single-post__article js-post-article'}
    )

    remove_tags = [
        #        dict(name='div', attrs={'class': 'stk-grid stk-theme_45496__mb_3'}),
        dict(name='span', attrs={'class': 'more'}),
        dict(name='span', attrs={'class': 'close'}),
        dict(name='div', attrs={'class': 'socials js-socials-icons'})
    ]

    feeds = [('The Project.', 'https://www.proekt.media/en/feed/')]

    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self, user_agent='common_words/based')
        return br
